import { uiProperties, uiStyleProperties } from './common'

// datePicker
export const datePickerProperties = [
    ...uiProperties.filter(e => ['ui.placeholder', 'ui.clearable', 'ui.readonly'].indexOf(e.model) !== -1),
    ...uiStyleProperties.filter(e => ['ui.style.width'].indexOf(e.model) !== -1),
    {
        model: 'ui.editable',
        widget: 'switch',
        label: '可输入'
    },
    {
        model: 'ui.valueFormat',
        widget: 'select',
        label: (h) => {
            return (
                <span>绑定值格式 (可输入 <a href="https://element.faas.ele.me/#/zh-CN/component/date-picker#ri-qi-ge-shi" target="_blank">详情请见</a>) </span>
            )
        },
        enum: [
            { label: 'yyyy-MM-dd', value: 'yyyy-MM-dd' },
            { label: 'yyyy-MM', value: 'yyyy-MM' },
            { label: 'yyyy', value: 'yyyy' },
            { label: 'MM-dd', value: 'MM-dd' },
            { label: 'dd', value: 'dd' },
            { label: 'yyyy-MM-dd HH:mm:ss', value: 'yyyy-MM-dd HH:mm:ss' },
            { label: 'yyyy-MM-dd HH:mm', value: 'yyyy-MM-dd HH:mm' },
            { label: 'yyyy-MM-dd HH', value: 'yyyy-MM-dd HH' },
            { label: 'yyyy-MM HH:mm:ss', value: 'yyyy-MM HH:mm:ss' },
            { label: 'yyyy-MM HH:mm', value: 'yyyy-MM HH:mm' },
            { label: 'yyyy-MM HH', value: 'yyyy-MM HH' },
            { label: 'yyyy HH:mm:ss', value: 'yyyy HH:mm:ss' },
            { label: 'yyyy HH:mm', value: 'yyyy HH:mm' },
            { label: 'yyyy HH', value: 'yyyy-MM HH' }
        ],
        ui: {
            placeholder: '请选择或输入绑定值格式',
            filterable: true,
            allowCreate: true,
            clearable: true,
            style: {
                width: '100%'
            }
        }
    },
    {
        model: 'ui.format',
        widget: 'select',
        label: (h) => {
            return (
                <span>显示格式 (可输入 <a href="https://element.faas.ele.me/#/zh-CN/component/date-picker#ri-qi-ge-shi" target="_blank">详情请见</a>) </span>
            )
        },
        enum: [
            { label: 'yyyy-MM-dd', value: 'yyyy-MM-dd' },
            { label: 'yyyy-MM', value: 'yyyy-MM' },
            { label: 'yyyy', value: 'yyyy' },
            { label: 'MM-dd', value: 'MM-dd' },
            { label: 'dd', value: 'dd' },
            { label: 'yyyy-MM-dd HH:mm:ss', value: 'yyyy-MM-dd HH:mm:ss' },
            { label: 'yyyy-MM-dd HH:mm', value: 'yyyy-MM-dd HH:mm' },
            { label: 'yyyy-MM-dd HH', value: 'yyyy-MM-dd HH' },
            { label: 'yyyy-MM HH:mm:ss', value: 'yyyy-MM HH:mm:ss' },
            { label: 'yyyy-MM HH:mm', value: 'yyyy-MM HH:mm' },
            { label: 'yyyy-MM HH', value: 'yyyy-MM HH' },
            { label: 'yyyy HH:mm:ss', value: 'yyyy HH:mm:ss' },
            { label: 'yyyy HH:mm', value: 'yyyy HH:mm' },
            { label: 'yyyy HH', value: 'yyyy-MM HH' }
        ],
        ui: {
            placeholder: '请选择或输入显示格式',
            filterable: true,
            allowCreate: true,
            clearable: true,
            style: {
                width: '100%'
            }
        }
    },
    {
        model: 'ui.type',
        widget: 'select',
        label: '显示类型',
        enum: [
            { label: '年', value: 'year' },
            { label: '月', value: 'month' },
            { label: '周', value: 'week' },
            { label: '单日', value: 'date' },
            { label: '多日', value: 'dates' },
            { label: '日期时间', value: 'datetime' },
            { label: '日期范围', value: 'daterange' },
            { label: '日期时间范围', value: 'datetimerange' },
            { label: '月范围', value: 'monthrange' }
        ],
        ui: {
            placeholder: '请选择显示类型',
            style: {
                width: '100%'
            }
        }
    },
    {
        model: 'ui.startPlaceholder',
        widget: 'input',
        label: '开始日期占位符',
        ui: {
            placeholder: '开始日期占位符',
            maxlength: 100
        },
        if (model) {
            return model && model.ui && ['daterange', 'datetimerange', 'monthrange'].indexOf(model.ui.type) !== -1
        }
    },
    {
        model: 'ui.endPlaceholder',
        widget: 'input',
        label: '结束日期占位符',
        ui: {
            placeholder: '结束日期占位符',
            maxlength: 100
        },
        if (model) {
            return model && model.ui && ['daterange', 'datetimerange', 'monthrange'].indexOf(model.ui.type) !== -1
        }
    },
    {
        model: 'ui.rangeSeparator',
        widget: 'input',
        label: '分隔符',
        ui: {
            placeholder: '分隔符',
            maxlength: 10,
            clearable: true
        },
        if (model) {
            return model && model.ui && ['daterange', 'datetimerange', 'monthrange'].indexOf(model.ui.type) !== -1
        }
    },
    {
        model: 'ui.unlinkPanels',
        widget: 'switch',
        label: '取消范围选择器联动',
        if (model) {
            return model && model.ui && ['daterange', 'datetimerange', 'monthrange'].indexOf(model.ui.type) !== -1
        }
    },
    {
        model: 'ui.pickerOptions.firstDayOfWeek',
        widget: 'select',
        label: '周起始日',
        enum: [
            { value: 1, label: '周一' },
            { value: 2, label: '周二' },
            { value: 3, label: '周三' },
            { value: 4, label: '周四' },
            { value: 5, label: '周五' },
            { value: 6, label: '周六' },
            { value: 7, label: '周七' }
        ],
        ui: {
            style: {
                width: '100%'
            }
        }
    }
    // ,
    // {
    //     model: 'ui.align',
    //     widget: 'radioButton',
    //     label: '对齐方式',
    //     enum: [
    //         { label: 'left', value: '左' },
    //         { label: 'center', value: '中' },
    //         { label: 'right', value: '右' }
    //     ]
    // }
]
